﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using InfoSource.Data;

namespace InfoSource.Models.objects
{
	public class Contractor
	{
		#region Properties ======================================================================

		public string Name { get; set; }
		public string Code { get; set; }
		public int Rank { get; set; }
		public string Phone { get; set; }
		public string Fax { get; set; }
		public string City { get; set; }
		public string MainContact { get; set; }
		public string Restrictions { get; set; }
		public string Status { get; set; }
		public bool DoesServicePlanHVAC { get; set; }
		public bool DoesBrokeringHVAC { get; set; }
		public bool DoesServicePlanAppliances { get; set; }
		public bool DoesBrokeringAppliances { get; set; }
		public bool DoesMiscellaneous { get; set; }
		public bool DoesAfterHours { get; set; }

		#endregion

		#region Constructor =====================================================================

		public Contractor() { }

		#endregion

		#region Methods =========================================================================

		public Contractor ConvertFromDBObject(v_Ins_and_Sec_Contractors dbContractor)
		{
			this.Name = dbContractor.Name;
			this.Code = dbContractor.Code;
			this.Rank = (int)dbContractor.rank;
			this.City = dbContractor.City;
			this.Phone = dbContractor.Phone_number;
			this.Fax = dbContractor.Fax;
			this.MainContact = dbContractor.Main_contact;
			this.Restrictions = dbContractor.Restrictions;
			this.DoesServicePlanHVAC = (bool)dbContractor.HVACsp;
			this.DoesServicePlanAppliances = (bool)dbContractor.ApplianceSP;
			this.DoesBrokeringHVAC = (bool)dbContractor.HVACBroker;
			this.DoesBrokeringAppliances = (bool)dbContractor.ApplianceBroker;
			this.DoesMiscellaneous = (bool)dbContractor.Miscellaneous;

			return this;
		}

		#endregion
	}
}